﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Web.Script.Services;
using System.Web.Services;
using BluePortal.Medias.Core;
using System.ComponentModel;
using BluePortal.Framework;
using BluePortal.Encoding.Core.Providers;

namespace BluePortal.QuikStart.WSAjax
{
    [WebService(Namespace = "BluePortal.QuikStart.WSAjax")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class WSPlayer : System.Web.Services.WebService
    {
        BCVideo bc = new BCVideo();

        [WebMethod]
        public string GetVideoUrl(string vid, int formatId)
        {
            Guid guid = new Guid(vid);
            Video v = bc.FindVideoByID(guid);
            IVideoUploadService uservice = Factory.Create<IVideoUploadService>(v.Provider);
            uservice.ProviderOptions = v.ProviderOptions;
            return uservice.GetUrlFromVID(guid, formatId);
        }
    }
}
